package com.resume.controller;

import com.resume.enums.ResultEnum;
import com.resume.ex.ResumeException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 梁云亮
 * @Date: 2021/7/15 21:04
 * @Describe:
 */
@RestController
@RequestMapping("/test")
public class TestController {

    /**
     * 异常处理测试
     */
    @RequestMapping("/fun1")
    @ResponseBody
    public String fun1(int num, String name) throws Exception {
        System.out.println(num + "\t" + name);
        if (num == 4) {
            throw new ResumeException(ResultEnum.INTERNAL_SERVER_ERROR);
        }
        if (name == null) {
            throw new Exception("字段空值");
        }
        return "index";
    }

}
